import axios from '@/libs/request/axios'
import {getUri} from "@/libs/tools";

//获取影像件大类数据
export const getAttCategoriesList = (path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/getAttCategoriesList`,
        method: 'get'
    })
}

//根据大类编号获取影像件小类数据
export const getSubCategoriesList = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/getSubCategoriesList`,
        params:params,
        method: 'get'
    })
}

// 获取大类小类级联数据
export const getComAttachmentCascader = (busiNode,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/getComAttachmentCascader`,
        params:{
            busiNode:busiNode
        },
        method: 'post'
    })
}

// 新增附件大类
export const addAttachment = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/addAttachment`,
        data: params,
        method: 'post'
    })
}

//根据ID查询附件信息
export const getOneAttachment = (id,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/getOneAttachment/${id}`,
        method: 'post'
    })
}

// 新增附件规则
export const addAttachmentRule = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/addAttachmentRule`,
        data: params,
        method: 'post'
    })
}

//根据附件编号获取附件规则信息
export const queryAttachmentRule = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/queryAttachmentRule`,
        params:params,
        method: 'get'
    })
}

// 修改规则状态
export const updateAttachmentRule = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/updateAttachmentRule`,
        data: params,
        method: 'post'
    })
}

// 附件规则启用停用
export const updateAttachmentManage = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/updateAttachmentManage`,
        data: params,
        method: 'post'
    })
}

// 附件名称查询
export const searchAttachment = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/searchAttachment`,
        params: params,
        method: 'get'
    })
}

// 附件规则数据同步
export const ruleSynchro = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/ruleSynchro`,
        data: params,
        method: 'post'
    })
}

//附件查询
export const searchByParentId = (params,path) => {
    return axios.request({
        url: `/${path==''?getUri('image'):path}/manage/searchByParentId`,
        params:params,
        method: 'get'
    })
}

//附件数据同步
export const dataUpdateAttachment = (params) => {
    return axios.request({
        url: `/${getUri('image')}/image/dataUpdateAttachment`,
        data:params,
        method: 'post'
    })
}
